"""
@Project ：Python_Learning 
@File    ：66.加一.py
@IDE     ：PyCharm 
@Author  ：zhupp
@Date    ：2024/10/17 13:31 
"""
from typing import List


class Solution:
    def plusOne(self, digits: List[int]) -> List[int]:
        for i in range(len(digits)-1, -1, -1):
            if digits[i] != 9:
                digits[i] += 1
                return digits
            else:
                digits[i] = 0
        else:
            digits.append(1)
            return digits[::-1]



s = Solution()
print(s.plusOne([9, 9]))

